import router from '@/router'
import { getToken } from '@/utils/auth'

router.beforeEach(async function(to, from, next) {
  console.log(to, 'to')
  console.log(from, 'from')
  if (getToken()) {
    if ((to.name == '/reportReview/echocardiography' || to.name == '/reportReview/carotidArtery') && from.name == '/reportDetails') {
      to.meta.isback = true
    }
    to.path === '/login' ? next('/') : next()
  } else if (to.path === '/login') {
    next()
  } else {
    // next('/login?redirect=' + to.path)
    // Message.info('没有登陆凭证或者已过期，请重新登录')
    next('/login')
  }
})



